﻿using System;
using System.Collections.Generic;
using System.Text;
using Org.Eurekaa.DNJ.Settings;
using System.ComponentModel;
using System.Web.UI;
using Org.Eurekaa.DNJ.UI.Common;
using Org.Eurekaa.DNJ.Common;

namespace Org.Eurekaa.DNJ.UI.DNJSettings
{    
    [Serializable()]
    [TypeConverter(typeof(ExpandableObjectConverter))]
    public class BtnIconsSettings : GenericSettingsObject
    {
        [Description("")]
        [DefaultValue(EnmJQueryUIIconClass.none), NotifyParentProperty(true), RefreshProperties(RefreshProperties.Repaint)]
        public EnmJQueryUIIconClass Primary
        {
            get { return Get<EnmJQueryUIIconClass>("primary"); }
            set { this["primary"] = value; }
        }
        [Description("")]
        [DefaultValue(EnmJQueryUIIconClass.none), NotifyParentProperty(true), RefreshProperties(RefreshProperties.Repaint)]
        public EnmJQueryUIIconClass Secondary
        {
            get { return Get<EnmJQueryUIIconClass>("secondary"); }
            set { this["secondary"] = value; }
        }


    }


    [Serializable()]
    [TypeConverter(typeof(ExpandableObjectConverter))]
    public class DNJButtonSettings : GenericSettingsObject
    {

        private BtnIconsSettings _icons = new BtnIconsSettings();
        [PersistenceMode(PersistenceMode.Attribute),
        DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
        public BtnIconsSettings Icons
        {
            get { return _icons; }
            set { _icons = value; }
        }

        [Description("Whether to show any text - when set to false (display no text), icons (see icons option) must be enabled, otherwise it'll be ignored.")]
        [DefaultValue(true), NotifyParentProperty(true), RefreshProperties(RefreshProperties.Repaint)]
        public bool Text
        {
            get { return Get<bool>("text"); }
            set { this["text"] = value; }
        }

        [Description("Text to show on the button. When not specified (null), the element's html content is used, or its value attribute when it's an input element of type submit or reset; or the html content of the associated label element if its an input of type radio or checkbox")]
        [DefaultValue(""), NotifyParentProperty(true), RefreshProperties(RefreshProperties.Repaint)]
        public String Label
        {
            get { return Get<String>("label"); }
            set { this["label"] = value; }
        }

        public override void PrepareJSON()
        {
            //base.PrepareJSON();
            Text = true;
            this["icons"] = _icons;
            if (this.Label == String.Empty)
                Label = null;
        }

    }
}
